#include "VoEConnectionObserverImpl.h"


VoEConnectionObserverImpl::VoEConnectionObserverImpl(void)
{
	m_mid_OnPeriodicDeadOrAlive = 0;
}


VoEConnectionObserverImpl::~VoEConnectionObserverImpl(void)
{
}

bool VoEConnectionObserverImpl::init_jni(JNIEnv* env)
{
	bool result = false;

	do 
	{
		m_mid_OnPeriodicDeadOrAlive = (env)->GetMethodID(m_cls, "onPeriodicDeadOrAlive", "(IZ)V");
		if(!m_mid_OnPeriodicDeadOrAlive)
			break;

		result = true;

	} while (false);

	return result;
}

void VoEConnectionObserverImpl::OnPeriodicDeadOrAlive(const int channel, const bool alive)
{
	JNIEnv* env = 0;

	if(before(&env))
	{
		(env)->CallVoidMethod(m_obj, m_mid_OnPeriodicDeadOrAlive, channel, alive);

		after(env);
	}
}